import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: '/login',
    component: () => import('@/views/admin/LoginView.vue')
  },
  {
    path: '/home',
    name: 'home',
    redirect: '/home/welcome',
    component: () => import('@/views/admin/HomeView.vue'),
    children: [
      {
        path: 'welcome',
        name: 'welcome',
        component: () => import('@/views/admin/WelcomeView.vue')
      },
      {
        path: 'vip',
        name: 'vip',
        component: () => import('@/views/admin/vip/VipList.vue')
      },
      {
        path: 'userinfo',
        name: 'userinfo',
        component: () => import('@/views/admin/userinfo/UserinfoList.vue')
      },
      {
        path: 'category',
        name: 'category',
        meta: { type: 1 },
        component: () => import('@/views/admin/category/CategoryList.vue')
      },
      {
        path: 'vip/category',
        name: 'vipCategory',
        meta: { type: 2 },
        component: () => import('@/views/admin/category/CategoryList.vue')
      },
      {
        path: 'tag',
        name: 'tag',
        meta: { type: 1 },
        component: () => import('@/views/admin/tag/TagList.vue')
      },
      {
        path: 'vip/tag',
        name: 'vipTag',
        meta: { type: 2 },
        component: () => import('@/views/admin/tag/TagList.vue')
      },
      {
        path: 'apply',
        name: 'blogApply',
        component: () => import('@/views/admin/blog/BlogApply.vue')
      },
      {
        path: 'blog',
        name: 'blog',
        meta: { type: 1 },
        component: () => import('@/views/admin/blog/BlogList.vue')
      },
      {
        path: 'vip/blog',
        name: 'vipBlog',
        meta: { type: 2 },
        component: () => import('@/views/admin/blog/BlogList.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
